package com.ophiux.common.tools.util;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang3.StringUtils;


public class RequestHolderUtil {
	/**
	 * 从header中获取token
	 * @param httpRequest
	 * @return
	 */
	public static String getRequestToken(HttpServletRequest httpRequest) {
		// 从header中获取token
		String token = httpRequest.getHeader("Authorization");
		// 如果header中不存在token，则从参数中获取token
		if (StringUtils.isEmpty(token)) {
			token = httpRequest.getParameter("Authorization");
		}
		return token;
	}
}
